package simple.enums;

public enum DilutionOfPrecisionGrade {
	IDEAL(0,2), EXCELLENT(2,3), GOOD(4,6), MODERATE(7,8), FAIR(9,20), POOR(20,50), UNKNOWN(Double.NaN, Double.NaN);
	
	private double lower;
	private double upper;
	
	DilutionOfPrecisionGrade(double lowerLimit, double upperLimit) {
		this.lower = lowerLimit;
		this.upper = upperLimit;
	}

	public static DilutionOfPrecisionGrade parseGrade(double grade){

		if(grade >= 0 && grade < 2){
			return DilutionOfPrecisionGrade.IDEAL;
		}
		else if(grade >= 2 && grade < 3){
			return DilutionOfPrecisionGrade.EXCELLENT;
		}
		else if(grade >= 4 && grade < 6){
			return DilutionOfPrecisionGrade.GOOD;
		}
		else if(grade >= 7 && grade < 8){
			return DilutionOfPrecisionGrade.MODERATE;
		}
		else if(grade >= 9 && grade < 20){
			return DilutionOfPrecisionGrade.FAIR;
		}
		else if(grade >= 20 && grade < 50){
			return DilutionOfPrecisionGrade.POOR;
		}
		else{
			return DilutionOfPrecisionGrade.UNKNOWN;
		}
	}
}
